\hypertarget{class_particle_manager}{
\section{ParticleManager Class Reference}
\label{class_particle_manager}\index{ParticleManager@{ParticleManager}}
}


{\ttfamily \#include $<$ParticleManager.h$>$}

\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_particle_manager_a1a4cda995e8ea8159aa8f8caca024227}{ParticleManager} (const float \_\-height, const float \_\-width, const float \_\-verticalCount, const float \_\-horizontalCount, const float \_\-mass, const float \_\-radius)
\item 
void \hyperlink{class_particle_manager_a59f8df5f0b32869086de11aefa67d00c}{evaluateEularExplicit} ()
\item 
void \hyperlink{class_particle_manager_aa758e2519b5e88d7cdf42508a07f313c}{evaluateRK2} ()
\item 
void \hyperlink{class_particle_manager_aad46fbf252811fb2ca4e1d396ce5c8c2}{evaluateRK4} ()
\item 
void \hyperlink{class_particle_manager_ac19db1f45dcdcf0c4b7897b4eeb0f666}{evaluateVerlet} ()
\item 
void \hyperlink{class_particle_manager_a285edff0e85946e964dbfea0e2ec786a}{loadGeometry} ()
\begin{DoxyCompactList}\small\item\em creates vbo for drawing \end{DoxyCompactList}\item 
void \hyperlink{class_particle_manager_a4a199ea4b7f1e81a9e211bd102b86f8a}{draw} (ngl::TransformStack \_\-txStack, \hyperlink{class_shader_manager}{ShaderManager} $\ast$io\_\-sman, const std::string \_\-shader)
\begin{DoxyCompactList}\small\item\em draws the particles \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{class_particle_manager_a1887fd16f12192c375052976c1447cfe}{evaluateNetForces} ()
\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
std::vector$<$ \hyperlink{class_particle}{Particle} $\ast$ $>$ $\ast$ \hyperlink{class_particle_manager_a3dd9ed129b9a7626e4e66ed8a3e21f64}{m\_\-particleList}
\end{DoxyCompactItemize}


\subsection{Detailed Description}


Definition at line 12 of file ParticleManager.h.



\subsection{Constructor \& Destructor Documentation}
\hypertarget{class_particle_manager_a1a4cda995e8ea8159aa8f8caca024227}{
\index{ParticleManager@{ParticleManager}!ParticleManager@{ParticleManager}}
\index{ParticleManager@{ParticleManager}!ParticleManager@{ParticleManager}}
\subsubsection[{ParticleManager}]{\setlength{\rightskip}{0pt plus 5cm}ParticleManager::ParticleManager (
\begin{DoxyParamCaption}
\item[{const float}]{\_\-height, }
\item[{const float}]{\_\-width, }
\item[{const float}]{\_\-verticalCount, }
\item[{const float}]{\_\-horizontalCount, }
\item[{const float}]{\_\-mass, }
\item[{const float}]{\_\-radius}
\end{DoxyParamCaption}
)}}
\label{class_particle_manager_a1a4cda995e8ea8159aa8f8caca024227}


Definition at line 9 of file ParticleManager.cpp.



References Particle::setPosition().


\begin{DoxyCode}
{
    //use the given params to create particles and position them to fill in the 2
      d space
    float xStep = _width / _horizontalCount;
    float zStep = _height / _verticalCount;

    float xStartPos = _width / 2;
    float zStartPos = _height / 2;

    for (int z = 0; z < _verticalCount; z++)
    {
        for (int x = 0; x < _horizontalCount; x++)
        {
            //determine id of next particle to create
            int id = (z * _verticalCount) + x;

            //create a particle
            Particle* p = new Particle(id, _mass, _radius);

            //set position of particle
            p->setPosition(ngl::Vector(xStartPos + (x * xStep), 0, zStartPos + (z
       * zStep)));
        }
    }

    //connect particles with their neighbours for structural, shear and flexion
}
\end{DoxyCode}


Here is the call graph for this function:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=384pt]{class_particle_manager_a1a4cda995e8ea8159aa8f8caca024227_cgraph}
\end{center}
\end{figure}




\subsection{Member Function Documentation}
\hypertarget{class_particle_manager_a4a199ea4b7f1e81a9e211bd102b86f8a}{
\index{ParticleManager@{ParticleManager}!draw@{draw}}
\index{draw@{draw}!ParticleManager@{ParticleManager}}
\subsubsection[{draw}]{\setlength{\rightskip}{0pt plus 5cm}void ParticleManager::draw (
\begin{DoxyParamCaption}
\item[{ngl::TransformStack}]{\_\-txStack, }
\item[{{\bf ShaderManager} $\ast$}]{io\_\-sman, }
\item[{const std::string}]{\_\-shader}
\end{DoxyParamCaption}
)}}
\label{class_particle_manager_a4a199ea4b7f1e81a9e211bd102b86f8a}


draws the particles 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em \_\-txStack} & the transform stack, used for pushing and popping opengl states \\
\hline
\mbox{\tt in,out}  & {\em io\_\-sman} & the shader manager, used for shading/rendering of the objects \\
\hline
\mbox{\tt in}  & {\em \_\-shader} & the shader used for drawing \\
\hline
\end{DoxyParams}


Definition at line 130 of file ParticleManager.cpp.



References Particle::getPosition(), and ShaderManager::updateModelColor().


\begin{DoxyCode}
{
    ngl::VBOPrimitives* prim=ngl::VBOPrimitives::instance();

    //DEBUG FOR NOW -------------------------
    bool m_drawWireframe = true;

    //loop through all particles
    BOOST_FOREACH(Particle* particle, *m_particleList)
    {
        //draw sphere

        if (m_drawWireframe) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
        _txStack.pushTransform();
        {
            _txStack.setPosition(particle->getPosition().m_x, particle->
      getPosition().m_y, particle->getPosition().m_z);

            _txStack.setScale(particle->getRadius(), particle->getRadius(), parti
      cle->getRadius());

            //update transform and color to shader
            io_sman->updateModelColor(_shader, _txStack.getCurrAndGlobal().getMat
      rix(), ngl::Colour(0, 0, 1));

            //draw sphere
            prim->draw("sphere");
        }
        _txStack.popTransform();
        if (m_drawWireframe) glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
    }

}
\end{DoxyCode}


Here is the call graph for this function:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=400pt]{class_particle_manager_a4a199ea4b7f1e81a9e211bd102b86f8a_cgraph}
\end{center}
\end{figure}


\hypertarget{class_particle_manager_a59f8df5f0b32869086de11aefa67d00c}{
\index{ParticleManager@{ParticleManager}!evaluateEularExplicit@{evaluateEularExplicit}}
\index{evaluateEularExplicit@{evaluateEularExplicit}!ParticleManager@{ParticleManager}}
\subsubsection[{evaluateEularExplicit}]{\setlength{\rightskip}{0pt plus 5cm}void ParticleManager::evaluateEularExplicit (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_particle_manager_a59f8df5f0b32869086de11aefa67d00c}


Definition at line 73 of file ParticleManager.cpp.



References evaluateNetForces(), and m\_\-particleList.


\begin{DoxyCode}
{
    //evaluate net forces on each particle
    evaluateNetForces();

    //loop over the list of particles and integrate them
    BOOST_FOREACH(Particle* currentParticle, *m_particleList)
    {
        //apply eular forward explicit integration to get new positions of partic
      les
        //use Newton's 2nd law F = ma => get accelation a = F / m
        //use a = d(v) / dt => integrate to get velocity v
        //use v = d(s) / dt => integrate to get displacement s


    }


}
\end{DoxyCode}


Here is the call graph for this function:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=400pt]{class_particle_manager_a59f8df5f0b32869086de11aefa67d00c_cgraph}
\end{center}
\end{figure}


\hypertarget{class_particle_manager_a1887fd16f12192c375052976c1447cfe}{
\index{ParticleManager@{ParticleManager}!evaluateNetForces@{evaluateNetForces}}
\index{evaluateNetForces@{evaluateNetForces}!ParticleManager@{ParticleManager}}
\subsubsection[{evaluateNetForces}]{\setlength{\rightskip}{0pt plus 5cm}void ParticleManager::evaluateNetForces (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_particle_manager_a1887fd16f12192c375052976c1447cfe}


Definition at line 43 of file ParticleManager.cpp.



References Particle::addToNetForce(), Particle::clearNetForce(), Particle::getMass(), Particle::getNeighbourList(), m\_\-particleList, and Configuration::s\_\-accelerationOfFreeFall.


\begin{DoxyCode}
{
    //calculate the net force on each particle wrt its neighbours
    BOOST_FOREACH(Particle* currentParticle, *m_particleList)
    {
        //get neighbour list for current particle
        std::vector<Particle*>* neighbourList = currentParticle->
      getNeighbourList();

        //evaluate net force of neighbours on current particle

        //clear net force
        currentParticle->clearNetForce();

        //adds in gravity
        currentParticle->addToNetForce(new ngl::Vector(0, currentParticle->
      getMass() * Configuration::s_accelerationOfFreeFall, 0));

        //loop for each neighbour => adds spring and damping forces
        BOOST_FOREACH(Particle* neighbour, *neighbourList)
        {
            //adds in spring force

            //adds in damping force
        }

        //adds in wind interaction

        //clamp force within a force range
    }
}
\end{DoxyCode}


Here is the call graph for this function:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=400pt]{class_particle_manager_a1887fd16f12192c375052976c1447cfe_cgraph}
\end{center}
\end{figure}




Here is the caller graph for this function:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=400pt]{class_particle_manager_a1887fd16f12192c375052976c1447cfe_icgraph}
\end{center}
\end{figure}


\hypertarget{class_particle_manager_aa758e2519b5e88d7cdf42508a07f313c}{
\index{ParticleManager@{ParticleManager}!evaluateRK2@{evaluateRK2}}
\index{evaluateRK2@{evaluateRK2}!ParticleManager@{ParticleManager}}
\subsubsection[{evaluateRK2}]{\setlength{\rightskip}{0pt plus 5cm}void ParticleManager::evaluateRK2 (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_particle_manager_aa758e2519b5e88d7cdf42508a07f313c}


Definition at line 92 of file ParticleManager.cpp.



References evaluateNetForces().


\begin{DoxyCode}
{
    //evaluate net forces on each particle
    evaluateNetForces();

    //apply RK2 integration to get new positions of particles
    //TODO
}
\end{DoxyCode}


Here is the call graph for this function:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=400pt]{class_particle_manager_aa758e2519b5e88d7cdf42508a07f313c_cgraph}
\end{center}
\end{figure}


\hypertarget{class_particle_manager_aad46fbf252811fb2ca4e1d396ce5c8c2}{
\index{ParticleManager@{ParticleManager}!evaluateRK4@{evaluateRK4}}
\index{evaluateRK4@{evaluateRK4}!ParticleManager@{ParticleManager}}
\subsubsection[{evaluateRK4}]{\setlength{\rightskip}{0pt plus 5cm}void ParticleManager::evaluateRK4 (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_particle_manager_aad46fbf252811fb2ca4e1d396ce5c8c2}


Definition at line 101 of file ParticleManager.cpp.



References evaluateNetForces().


\begin{DoxyCode}
{
    //evaluate net forces on each particle
    evaluateNetForces();

    //apply RK4 integration to get new positions of particles
    //TODO
}
\end{DoxyCode}


Here is the call graph for this function:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=400pt]{class_particle_manager_aad46fbf252811fb2ca4e1d396ce5c8c2_cgraph}
\end{center}
\end{figure}


\hypertarget{class_particle_manager_ac19db1f45dcdcf0c4b7897b4eeb0f666}{
\index{ParticleManager@{ParticleManager}!evaluateVerlet@{evaluateVerlet}}
\index{evaluateVerlet@{evaluateVerlet}!ParticleManager@{ParticleManager}}
\subsubsection[{evaluateVerlet}]{\setlength{\rightskip}{0pt plus 5cm}void ParticleManager::evaluateVerlet (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_particle_manager_ac19db1f45dcdcf0c4b7897b4eeb0f666}


Definition at line 110 of file ParticleManager.cpp.



References evaluateNetForces().


\begin{DoxyCode}
{
    //evaluate net forces on each particle
    evaluateNetForces();

    //apply Verlet integration to get new positions of particles
    //TODO
}
\end{DoxyCode}


Here is the call graph for this function:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=400pt]{class_particle_manager_ac19db1f45dcdcf0c4b7897b4eeb0f666_cgraph}
\end{center}
\end{figure}


\hypertarget{class_particle_manager_a285edff0e85946e964dbfea0e2ec786a}{
\index{ParticleManager@{ParticleManager}!loadGeometry@{loadGeometry}}
\index{loadGeometry@{loadGeometry}!ParticleManager@{ParticleManager}}
\subsubsection[{loadGeometry}]{\setlength{\rightskip}{0pt plus 5cm}void ParticleManager::loadGeometry (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_particle_manager_a285edff0e85946e964dbfea0e2ec786a}


creates vbo for drawing 



Definition at line 120 of file ParticleManager.cpp.


\begin{DoxyCode}
{
    //create vbo for obstacle
    ngl::VBOPrimitives* prim = ngl::VBOPrimitives::instance();

    prim->createVBOSphere("sphere", 1, 16);

}
\end{DoxyCode}


\subsection{Member Data Documentation}
\hypertarget{class_particle_manager_a3dd9ed129b9a7626e4e66ed8a3e21f64}{
\index{ParticleManager@{ParticleManager}!m\_\-particleList@{m\_\-particleList}}
\index{m\_\-particleList@{m\_\-particleList}!ParticleManager@{ParticleManager}}
\subsubsection[{m\_\-particleList}]{\setlength{\rightskip}{0pt plus 5cm}std::vector$<${\bf Particle}$\ast$$>$$\ast$ {\bf ParticleManager::m\_\-particleList}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_particle_manager_a3dd9ed129b9a7626e4e66ed8a3e21f64}


Definition at line 49 of file ParticleManager.h.



The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
include/\hyperlink{_particle_manager_8h}{ParticleManager.h}\item 
src/\hyperlink{_particle_manager_8cpp}{ParticleManager.cpp}\end{DoxyCompactItemize}
